/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itsc.ds2.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Martinez
 */
@Entity
@Table(name = "assignscholarship")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Assignscholarship.findAll", query = "SELECT a FROM Assignscholarship a"),
    @NamedQuery(name = "Assignscholarship.findById", query = "SELECT a FROM Assignscholarship a WHERE a.id = :id"),
    @NamedQuery(name = "Assignscholarship.findByDate", query = "SELECT a FROM Assignscholarship a WHERE a.date = :date")})
public class Assignscholarship implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @JoinColumn(name = "IdStudent", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Student idStudent;
    @JoinColumn(name = "IdScholarship", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Scholarship idScholarship;

    public Assignscholarship() {
    }

    public Assignscholarship(Integer id) {
        this.id = id;
    }

    public Assignscholarship(Integer id, Date date) {
        this.id = id;
        this.date = date;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Student getIdStudent() {
        return idStudent;
    }

    public void setIdStudent(Student idStudent) {
        this.idStudent = idStudent;
    }

    public Scholarship getIdScholarship() {
        return idScholarship;
    }

    public void setIdScholarship(Scholarship idScholarship) {
        this.idScholarship = idScholarship;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Assignscholarship)) {
            return false;
        }
        Assignscholarship other = (Assignscholarship) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itsc.ds2.model.Assignscholarship[ id=" + id + " ]";
    }
    
}
